{% extends "jinhtml/skel.html" %}
{% block headcss %}
  <style type="text/css">
    div.wholeform{
      margin-top: 20px;
      margin-left: 20px;
    }
    div.indented{
      padding-left: 35px;
    }
    p.question{
      font-size: xx-large;
    }
    input.loginfield{
      width: 300px;
    }
    ul.nolistsymbol{
      list-style-type: none;
      margin-left: 20px;
      margin-right: 0px;
      margin-top: 0px;
      margin-bottom: 0px;
      padding: 0px;
    }
    table#ncdatalist{
      border-collapse: collapse;
    }
    table#ncdatalist td{
      padding: 3px;
    }
  </style>
{% endblock %}

{% block onload %}
  var switchmonthobj = document.getElementById("buttonimport");
  switchmonthobj.className += "selected";
  switchmonthobj.onclick = "";
{% endblock %}

{% block headjs %}
  <script type="text/javascript" src="js/data.js"></script>
  <script type="text/javascript" src="js/imnc.js"></script>
  <script type="text/javascript" src="js/imgc.js"></script>
  <script type="text/javascript">
    function selsrc_initbut(){
      if(document.getElementById("srcgcal").checked){
        imgcal_init();
      }else if(document.getElementById("srcnc").checked){
        imnc_init();
      }else{
        status_bar_warning("請至少選取一個項目！");
      }
    }
  </script>
{% endblock %}

{% block body %}
  <div id="imstepforminit" class="wholeform">
    <p class="question">請問您想要從哪裡匯入資料？</p>
    <input type="radio" id="srcgcal" name="selsource" value="googlecal">Google 行事曆<br>
    <input type="radio" id="srcnc" name="selsource" value="ntuceiba">臺大 CEIBA 網站<br><br>
    <input type="button" value="下一步" onclick="selsrc_initbut()">
  </div>
  <div id="imntuceibainfo" class="wholeform" style="display: none;">
    <p class="question">請問您想透過哪一種方式取得 CEIBA 網站上的資料？</p>
    <input type="radio" id="nclogin" name="ncinfo" value="directlogin" checked>透過帳號密碼直接登入 CEIBA 網站<br>
    <div class="indented">
      網址：<input type="text" class="loginfield" id="ncloginurl" value="https://ceiba.ntu.edu.tw"><br>
      認證：<input type="text" class="loginfield" id="ncloginauth" value="https://web2.cc.ntu.edu.tw/p/s/login2/p1.php"><br>
      帳號：<input type="text" class="loginfield" id="ncloginacct"><br>
      密碼：<input type="password" class="loginfield" id="ncloginpass"><br>
    </div>
    <br>
    <input type="radio" id="ncupload" name="ncinfo" value="uploadpage">上傳 CEIBA 作業區的網頁檔案<br>
    <div class="indented">
      <form name="fileuploadform" action="access/echo" method="post" enctype="multipart/form-data">
      檔案：<input name="echo" type="file" id="ncfile"><br>
      編碼：<select id="ncfileenc">
      <option value="Big5">Big5 (臺大 CEIBA 預設編碼)</option>
      <option value="UTF-8">UTF-8</option>
	  </select>
      </form>
    </div>
    <br>
    在「內容」欄位加入以下資訊：
    <ul class="nolistsymbol">
      <li><input type="checkbox" id="ncaddtitle">名稱</li>
      <li><input type="checkbox" id="ncaddmember">成員</li>
      <li><input type="checkbox" id="ncaddmethod">繳交方法</li>
      <li><input type="checkbox" id="ncaddpercent">成績比重</li>
      <li><input type="checkbox" id="ncadddue">繳交期限</li>
      <li><input type="checkbox" id="ncaddlate">逾期繳交</li>
      <li><input type="checkbox" id="ncaddsub">繳交日期</li>
      <li><input type="checkbox" id="ncaddcomment">作業評語</li>
    </ul>
    <br>
    <input type="checkbox" id="ncviewagain" checked>選擇要匯入的項目（可能花費較長的時間和較大的網路流量）<br>
    <input type="checkbox" id="ncmerge" checked>透過資料比對以避免重複匯入
	<input type="radio" id="ncdupignore" name="ncallowoverwrite" checked>忽略
	<input type="radio" id="ncdupupdate" name="ncallowoverwrite">取代
	先前匯入的資料
	<br>
	<br>
    <input type="button" value="重新選擇來源" onclick="imnc_deinit()">
    <input type="button" value="開始匯入" onclick="imnc_argok()">
  </div>
  <div id="imntuceibacheck" class="wholeform" style="display: none;">
    <p id="ncdatalisttitle" class="question">可匯入的資料清單</p>
    <table id="ncdatalist" border="1">
      <tr>
        <td>編號</td>
        <td>動作</td>
        <td colspan="2">日期與時間</td>
        <td>標題</td>
        <td>成員</td>
        <td>繳交方法</td>
        <td>成績比重</td>
        <td>逾期繳交</td>
        <td>繳交日期</td>
        <td>作業評語</td>
      </tr>
    </table>
    <br>
    <input type="button" value="返回設定頁面" onclick="imnc_checkopt()">
    <input type="button" value="確定" onclick="imnc_singlesend()">
  </div>
  <div id="imntuceibacomplete" class="wholeform" style="display: none;">
    <p class="question">資料匯入結果</p>
  	<div id="ncimportresult">
	</div>
  </div>
{% endblock %}
